package com.wtgroup.demo.leetcode.q046_全排列;

import com.wtgroup.demo.common.util.RandomUtil;
import com.wtgroup.demo.common.util.Tools;
import org.junit.Test;

import java.util.Arrays;
import java.util.List;

/**
 * @author dafei
 * @version 0.1
 * @date 2021/4/26 10:41
 */
public class Q046_Test {

    public static void main(String[] args) {
        Q046_My1 q046_my1 = new Q046_My1();
        int[] input = {1, 2, 3};
        List<List<Integer>> res = q046_my1.permute(input);
        System.out.println(res);
    }


    @Test
    public void foo1() {
        Q046_LC q046_lc = new Q046_LC();
        int[] input = {1, 2, 3};
        List<List<Integer>> res = q046_lc.permute(input);
        System.out.println(res);
    }


    @Test
    public void judge() {
        Q046_My1 q046_my1 = new Q046_My1();
        Q046_LC q046_lc = new Q046_LC();
        Q046_LC2 q046_lc2 = new Q046_LC2();
        int iterNum = 10;
        for (int i = 0; i < iterNum; i++) {
            int[] input = RandomUtil.randomArray((int) (Math.random()*5+1), 1, 10);
            List<List<Integer>> res1 = q046_my1.permute(Arrays.copyOf(input, input.length));
            List<List<Integer>> res2 = q046_lc.permute(Arrays.copyOf(input, input.length));
            List<List<Integer>> res3 = q046_lc2.permute(Arrays.copyOf(input, input.length));
            System.out.println("--------------------------");
            Tools.printArray(input);
            System.out.println(res1);
            System.out.println(res2);
            System.out.println(res3);
        }
    }


}
